home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / GNU / emacs.inst / emacs19.idb / usr / gnu / info / elisp-25.z / elisp-25
Encoding:
GNU Info File  |  1994-08-02  |  49.1 KB  |  1,225 lines

  1. This is Info file elisp, produced by Makeinfo-1.55 from the input file
  2. elisp.texi.
  3.  
  4.    This version is newer than the second printed edition of the GNU
  5. Emacs Lisp Reference Manual.  It corresponds to Emacs Version 19.19.
  6.  
  7.    Published by the Free Software Foundation 675 Massachusetts Avenue
  8. Cambridge, MA 02139 USA
  9.  
  10.    Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
  11.  
  12.    Permission is granted to make and distribute verbatim copies of this
  13. manual provided the copyright notice and this permission notice are
  14. preserved on all copies.
  15.  
  16.    Permission is granted to copy and distribute modified versions of
  17. this manual under the conditions for verbatim copying, provided that
  18. the entire resulting derived work is distributed under the terms of a
  19. permission notice identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for modified
  23. versions, except that this permission notice may be stated in a
  24. translation approved by the Foundation.
  25.  
  26.    Permission is granted to copy and distribute modified versions of
  27. this manual under the conditions for verbatim copying, provided also
  28. that the section entitled "GNU Emacs General Public License" is included
  29. exactly as in the original, and provided that the entire resulting
  30. derived work is distributed under the terms of a permission notice
  31. identical to this one.
  32.  
  33.    Permission is granted to copy and distribute translations of this
  34. manual into another language, under the above conditions for modified
  35. versions, except that the section entitled "GNU Emacs General Public
  36. License" may be included in a translation approved by the Free Software
  37. Foundation instead of in the original English.
  38.  
  39. 
  40. File: elisp,  Node: Regexp Search,  Next: Replacement,  Prev: Regular Expressions,  Up: Searching and Matching
  41.  
  42. Regular Expression Searching
  43. ============================
  44.  
  45.    In GNU Emacs, you can search for the next match for a regexp either
  46. incrementally or not.  Incremental search commands are described in the
  47. `The GNU Emacs Manual'.  *Note Regular Expression Search: (emacs)Regexp
  48. Search.  Here we describe only the search functions useful in programs.
  49. The principal one is `re-search-forward'.
  50.  
  51.  - Command: re-search-forward REGEXP &optional LIMIT NOERROR REPEAT
  52.      This function searches forward in the current buffer for a string
  53.      of text that is matched by the regular expression REGEXP.  The
  54.      function skips over any amount of text that is not matched by
  55.      REGEXP, and leaves point at the end of the first string found that
  56.      does match.
  57.  
  58.      If the search is successful (i.e., if text matching REGEXP is
  59.      found), then point moves to the end of that text, and the function
  60.      returns the new value of point.
  61.  
  62.      What happens when the search fails depends on the value of
  63.      NOERROR.  If NOERROR is `nil', a `search-failed' error is
  64.      signaled.  If NOERROR is `t', `re-search-forward' does nothing and
  65.      returns `nil'.  If NOERROR is neither `nil' nor `t', then
  66.      `re-search-forward' moves point to LIMIT (or the end of the
  67.      buffer) and returns `nil'.
  68.  
  69.      If LIMIT is non-`nil' (it must be a position in the current
  70.      buffer), then it is the upper bound to the search.  No match
  71.      extending after that position is accepted.
  72.  
  73.      If REPEAT is supplied (it must be a positive number), then the
  74.      search is repeated that many times (each time starting at the end
  75.      of the previous time's match).  The call succeeds if all these
  76.      searches succeeded, and point is left at the end of the match
  77.      found by the last search.  Otherwise the search fails.
  78.  
  79.      In the following example, point is initially located directly
  80.      before the `T'.  After evaluating the form, point is located at
  81.      the end of that line (between the `t' of `hat' and before the
  82.      newline).
  83.  
  84.           ---------- Buffer: foo ----------
  85.           I read "-!-The cat in the hat
  86.           comes back" twice.
  87.           ---------- Buffer: foo ----------
  88.           
  89.           (re-search-forward "[a-z]+" nil t 5)
  90.                => t
  91.           
  92.           ---------- Buffer: foo ----------
  93.           I read "The cat in the hat-!-
  94.           comes back" twice.
  95.           ---------- Buffer: foo ----------
  96.  
  97.  - Command: re-search-backward REGEXP &optional LIMIT NOERROR REPEAT
  98.      This function searches backward in the current buffer for a string
  99.      of text that is matched by the regular expression REGEXP, leaving
  100.      point at the beginning of the first text found.
  101.  
  102.      This function is analogous to `re-search-forward', but they are
  103.      not simple mirror images.  `re-search-forward' finds the match
  104.      whose beginning is as close as possible.  If `re-search-backward'
  105.      were a perfect mirror image, it would find the match whose end is
  106.      as close as possible.  However, in fact it finds the match whose
  107.      beginning is as close as possible.  The reason is that matching a
  108.      regular expression at a given spot always works from beginning to
  109.      end, and is done at a specified beginning position.  Thus, true
  110.      mirror-image behavior would require a special feature for matching
  111.      regexps from end to beginning.
  112.  
  113.  - Function: string-match REGEXP STRING &optional START
  114.      This function returns the index of the start of the first match for
  115.      the regular expression REGEXP in STRING, or `nil' if there is no
  116.      match.  If START is non-`nil', the search starts at that index in
  117.      STRING.
  118.  
  119.      For example,
  120.  
  121.           (string-match
  122.            "quick" "The quick brown fox jumped quickly.")
  123.                => 4
  124.           (string-match
  125.            "quick" "The quick brown fox jumped quickly." 8)
  126.                => 27
  127.  
  128.      The index of the first character of the string is 0, the index of
  129.      the second character is 1, and so on.
  130.  
  131.      After this function returns, the index of the first character
  132.      beyond the match is available as `(match-end 0)'.  *Note Match
  133.      Data::.
  134.  
  135.           (string-match
  136.            "quick" "The quick brown fox jumped quickly." 8)
  137.                => 27
  138.           
  139.           (match-end 0)
  140.                => 32
  141.  
  142.      The `match-beginning' and `match-end' functions are described
  143.      together; see *Note Match Data::.
  144.  
  145.  - Function: looking-at REGEXP
  146.      This function determines whether the text in the current buffer
  147.      directly following point matches the regular expression REGEXP.
  148.      "Directly following" means precisely that: the search is
  149.      "anchored" and it must succeed starting with the first character
  150.      following point.  The result is `t' if so, `nil' otherwise.
  151.  
  152.      This function does not move point, but it updates the match data,
  153.      which you can access using `match-beginning' or `match-end'.
  154.      *Note Match Data::.
  155.  
  156.      In this example, point is located directly before the `T'.  If it
  157.      were anywhere else, the result would be `nil'.
  158.  
  159.           ---------- Buffer: foo ----------
  160.           I read "-!-The cat in the hat
  161.           comes back" twice.
  162.           ---------- Buffer: foo ----------
  163.           
  164.           (looking-at "The cat in the hat$")
  165.                => t
  166.  
  167. 
  168. File: elisp,  Node: Replacement,  Next: Match Data,  Prev: Regexp Search,  Up: Searching and Matching
  169.  
  170. Replacement
  171. ===========
  172.  
  173.  - Function: perform-replace FROM-STRING REPLACEMENTS QUERY-FLAG
  174.           REGEXP-FLAG DELIMITED-FLAG &optional REPEAT-COUNT MAP
  175.      This function is the guts of `query-replace' and related commands.
  176.      It searches for occurrences of FROM-STRING and replaces some or
  177.      all of them.  If QUERY-FLAG is `nil', it replaces all occurrences;
  178.      otherwise, it asks the user what to do about each one.
  179.  
  180.      If REGEXP-FLAG is non-`nil', then FROM-STRING is considered a
  181.      regular expression; otherwise, it must match literally.  If
  182.      DELIMITED-FLAG is non-`nil', then only replacements surrounded by
  183.      word boundaries are considered.
  184.  
  185.      The argument REPLACEMENTS specifies what to replace occurrences
  186.      with.  If it is a string, that string is used.  It can also be a
  187.      list of strings, to be used in cyclic order.
  188.  
  189.      If REPEAT-COUNT is non-`nil', it should be an integer, the number
  190.      of occurrences to consider.  In this case, `perform-replace'
  191.      returns after considering that many occurrences.
  192.  
  193.      Normally, the keymap `query-replace-map' defines the possible user
  194.      responses.  The argument MAP, if non-`nil', is a keymap to use
  195.      instead of `query-replace-map'.
  196.  
  197.  - Variable: query-replace-map
  198.      This variable holds a special keymap that defines the valid user
  199.      responses for `query-replace' and related functions, as well as
  200.      `y-or-n-p' and `map-y-or-n-p'.  It is special in two ways:
  201.  
  202.         * The "key bindings" are not commands, just symbols that are
  203.           meaningful to the functions that use this map.
  204.  
  205.         * Prefix keys are not supported; each key binding must be for a
  206.           single event key sequence.  This is because the functions
  207.           don't use read key sequence to get the input; instead, they
  208.           read a single event and look it up "by hand."
  209.  
  210.    Here are the meaningful "bindings" for `query-replace-map'.  Several
  211. of them are meaningful only for `query-replace' and friends.
  212.  
  213. `act'
  214.      Do take the action.  The action being considered--in other words,
  215.      "yes."
  216.  
  217. `skip'
  218.      Do not take action for this question--in other words, "no."
  219.  
  220. `exit'
  221.      Answer this question "no," and don't ask any more.
  222.  
  223. `act-and-exit'
  224.      Answer this question "yes," and don't ask any more.
  225.  
  226. `act-and-show'
  227.      Answer this question "yes," but show the results--don't advance
  228.      yet.
  229.  
  230. `automatic'
  231.      Answer this question and all subsequent questions in the series
  232.      with "yes," without further user interaction.
  233.  
  234. `backup'
  235.      Move back to the previous place that a question was asked about.
  236.  
  237. `edit'
  238.      Enter a recursive edit to deal with this item--instead of any
  239.      other answer.
  240.  
  241. `delete-and-edit'
  242.      Delete the text being considered, then enter a recursive edit to
  243.      replace it.
  244.  
  245. `recenter'
  246.      Redisplay and center the window, then ask the same question again.
  247.  
  248. `quit'
  249.      Perform a quit right away.  Only the `y-or-n-p' functions use this
  250.      answer.
  251.  
  252. `help'
  253.      Display some help, then ask again.
  254.  
  255. 
  256. File: elisp,  Node: Match Data,  Next: Standard Regexps,  Prev: Replacement,  Up: Searching and Matching
  257.  
  258. The Match Data
  259. ==============
  260.  
  261.    Emacs keeps track of the positions of the start and end of segments
  262. of text found during a regular expression search.  This means, for
  263. example, that you can search for a complex pattern, such as a date in
  264. an Rmail message, and extract parts of it.
  265.  
  266.    Because the match data normally describe the most recent search only,
  267. you must be careful not to do another search inadvertently between the
  268. search you wish to refer back to and the use of the match data.  If you
  269. can't avoid another intervening search, you must save and restore the
  270. match data around it, to prevent it from being overwritten.
  271.  
  272. * Menu:
  273.  
  274. * Simple Match Data::     Accessing single items of match data,
  275.                 such as where a particular subexpression started.
  276. * Replacing Match::      Replacing a substring that was matched.
  277. * Entire Match Data::     Accessing the entire match data at once, as a list.
  278. * Saving Match Data::     Saving and restoring the match data.
  279.  
  280. 
  281. File: elisp,  Node: Simple Match Data,  Next: Replacing Match,  Up: Match Data
  282.  
  283. Simple Match Data Access
  284. ------------------------
  285.  
  286.    This section explains how to use the match data to find the starting
  287. point or ending point of the text that was matched by a particular
  288. search, or by a particular parenthetical subexpression of a regular
  289. expression.
  290.  
  291.  - Function: match-beginning COUNT
  292.      This function returns the position of the start of text matched by
  293.      the last regular expression searched for.  COUNT, a number,
  294.      specifies a subexpression whose start position is the value.  If
  295.      COUNT is zero, then the value is the position of the text matched
  296.      by the whole regexp.  If COUNT is greater than zero, then the
  297.      value is the position of the beginning of the text matched by the
  298.      COUNTth subexpression, regardless of whether it was used in the
  299.      final match.
  300.  
  301.      Subexpressions of a regular expression are those expressions
  302.      grouped inside of parentheses, `\(...\)'.  The COUNTth
  303.      subexpression is found by counting occurrences of `\(' from the
  304.      beginning of the whole regular expression.  The first
  305.      subexpression is numbered 1, the second 2, and so on.
  306.  
  307.      The value is `nil' for a parenthetical grouping inside of a `\|'
  308.      alternative that wasn't used in the match.
  309.  
  310.      The `match-end' function is similar to the `match-beginning'
  311.      function except that it returns the position of the end of the
  312.      matched text.
  313.  
  314.      Here is an example, with a comment showing the numbers of the
  315.      positions in the text:
  316.  
  317.           (string-match
  318.            "\\(qu\\)\\(ick\\)" "The quick fox jumped quickly.")
  319.                => 4            ;^^^^^^^^^^
  320.                                ;0123456789
  321.  
  322.           (match-beginning 1)               ; The beginning of the match
  323.                => 4                         ;   with `qu' is at index 4.
  324.  
  325.           (match-beginning 2)               ; The beginning of the match
  326.                => 6                         ;   with `ick' is at index 6.
  327.  
  328.           (match-end 1)                     ; The end of the match
  329.                => 6                         ;   with `qu' is at index 6.
  330.           
  331.           (match-end 2)                     ; The end of the match
  332.                => 9                         ;   with `ick' is at index 9.
  333.  
  334.      Here is another example.  Before the form is evaluated, point is
  335.      located at the beginning of the line.  After evaluating the search
  336.      form, point is located on the line between the space and the word
  337.      `in'.  The beginning of the entire match is at the 9th character
  338.      of the buffer (`T'), and the beginning of the match for the first
  339.      subexpression is at the 13th character (`c').
  340.  
  341.           (list
  342.             (re-search-forward "The \\(cat \\)")
  343.             (match-beginning 0)
  344.             (match-beginning 1))
  345.               => (t 9 13)
  346.           
  347.           ---------- Buffer: foo ----------
  348.           I read "The cat -!-in the hat comes back" twice.
  349.                   ^   ^
  350.                   9  13
  351.           ---------- Buffer: foo ----------
  352.  
  353.      (Note that in this case, the index returned is a buffer position;
  354.      the first character of the buffer counts as 1.)
  355.  
  356.  - Function: match-end COUNT
  357.      This function returns the position of the end of text matched by
  358.      the last regular expression searched for.  This function is
  359.      otherwise similar to `match-beginning'.
  360.  
  361. 
  362. File: elisp,  Node: Replacing Match,  Next: Entire Match Data,  Prev: Simple Match Data,  Up: Match Data
  363.  
  364. Replacing the Text That Matched
  365. -------------------------------
  366.  
  367.    This function replaces the text matched by the last search with
  368. REPLACEMENT.
  369.  
  370.  - Function: replace-match REPLACEMENT &optional FIXEDCASE LITERAL
  371.      If FIXEDCASE is non-`nil', then the case of the replacement text
  372.      is not changed; otherwise, the replacement text is converted to a
  373.      different case depending upon the capitalization of the text to be
  374.      replaced.  If the original text is all upper case, the replacement
  375.      text is converted to upper case, except when all of the words in
  376.      the original text are only one character long.  In that event, the
  377.      replacement text is capitalized.  If *all* of the words in the
  378.      original text are capitalized, then all of the words in the
  379.      replacement text are capitalized.
  380.  
  381.      If LITERAL is non-`nil', then REPLACEMENT is inserted exactly as
  382.      it is, the only alterations being case changes as needed.  If it
  383.      is `nil' (the default), then the character `\' is treated
  384.      specially.  If a `\' appears in REPLACEMENT, then it must be part
  385.      of one of the following sequences:
  386.  
  387.     `\&'
  388.           `\&' stands for the entire text being replaced.
  389.  
  390.     `\N'
  391.           `\N' stands for the Nth subexpression in the original regexp.
  392.           Subexpressions are those expressions grouped inside of
  393.           `\(...\)'.  N is a digit.
  394.  
  395.     `\\'
  396.           `\\' stands for a single `\' in the replacement text.
  397.  
  398.      `replace-match' leaves point at the end of the replacement text,
  399.      and returns `t'.
  400.  
  401. 
  402. File: elisp,  Node: Entire Match Data,  Next: Saving Match Data,  Prev: Replacing Match,  Up: Match Data
  403.  
  404. Accessing the Entire Match Data
  405. -------------------------------
  406.  
  407.    The functions `match-data' and `store-match-data' let you read or
  408. write the entire match data, all at once.
  409.  
  410.  - Function: match-data
  411.      This function returns a new list containing all the information on
  412.      what text the last search matched.  Element zero is the position
  413.      of the beginning of the match for the whole expression; element
  414.      one is the position of the end of the match for the expression.
  415.      The next two elements are the positions of the beginning and end
  416.      of the match for the first subexpression.  In general, element
  417.      number 2N corresponds to `(match-beginning N)'; and element number
  418.      2N + 1 corresponds to `(match-end N)'.
  419.  
  420.      All the elements are markers or `nil' if matching was done on a
  421.      buffer, and all are integers or `nil' if matching was done on a
  422.      string with `string-match'.  (In Emacs 18 and earlier versions,
  423.      markers were used even for matching on a string, except in the case
  424.      of the integer 0.)
  425.  
  426.      As always, there must be no possibility of intervening searches
  427.      between the call to a search function and the call to `match-data'
  428.      that is intended to access the match-data for that search.
  429.  
  430.           (match-data)
  431.                =>  (#<marker at 9 in foo>
  432.                     #<marker at 17 in foo>
  433.                     #<marker at 13 in foo>
  434.                     #<marker at 17 in foo>)
  435.  
  436.  - Function: store-match-data MATCH-LIST
  437.      This function sets the match data from the elements of MATCH-LIST,
  438.      which should be a list that was the value of a previous call to
  439.      `match-data'.
  440.  
  441.      If MATCH-LIST refers to a buffer that doesn't exist, you don't get
  442.      an error; that sets the match data in a meaningless but harmless
  443.      way.
  444.  
  445. 
  446. File: elisp,  Node: Saving Match Data,  Prev: Entire Match Data,  Up: Match Data
  447.  
  448. Saving and Restoring the Match Data
  449. -----------------------------------
  450.  
  451.    All asynchronous process functions (filters and sentinels) and
  452. functions that use `recursive-edit' should save and restore the match
  453. data if they do a search or if they let the user type arbitrary
  454. commands.  Saving the match data is useful in other cases as
  455. well--whenever you want to access the match data resulting from an
  456. earlier search, notwithstanding another intervening search.
  457.  
  458.    This example shows the problem that can arise if you fail to attend
  459. to this requirement:
  460.  
  461.      (re-search-forward "The \\(cat \\)")
  462.           => 48
  463.      (foo)                   ; Perhaps `foo' does
  464.                              ;   more searching.
  465.      (match-end 0)
  466.           => 61              ; Unexpected result---not 48!
  467.  
  468.    In Emacs versions 19 and later, you can save and restore the match
  469. data with `save-match-data':
  470.  
  471.  - Special Form: save-match-data BODY...
  472.      This special form executes BODY, saving and restoring the match
  473.      data around it.  This is useful if you wish to do a search without
  474.      altering the match data that resulted from an earlier search.
  475.  
  476.    You can use `store-match-data' together with `match-data' to imitate
  477. the effect of the special form `save-match-data'.  This is useful for
  478. writing code that can run in Emacs 18.  Here is how:
  479.  
  480.      (let ((data (match-data)))
  481.        (unwind-protect
  482.            ...   ; May change the original match data.
  483.          (store-match-data data)))
  484.  
  485. 
  486. File: elisp,  Node: Standard Regexps,  Next: Searching and Case,  Prev: Match Data,  Up: Searching and Matching
  487.  
  488. Standard Regular Expressions Used in Editing
  489. ============================================
  490.  
  491.    Here are the regular expressions standardly used in editing:
  492.  
  493.  - Variable: page-delimiter
  494.      This is the regexp describing line-beginnings that separate pages.
  495.      The default value is `"^\014"' (i.e., `"^^L"' or `"^\C-l"').
  496.  
  497.  - Variable: paragraph-separate
  498.      This is the regular expression for recognizing the beginning of a
  499.      line that separates paragraphs.  (If you change this, you may have
  500.      to change `paragraph-start' also.)  The default value is `"^[
  501.      \t\f]*$"', which is a line that consists entirely of spaces, tabs,
  502.      and form feeds.
  503.  
  504.  - Variable: paragraph-start
  505.      This is the regular expression for recognizing the beginning of a
  506.      line that starts *or* separates paragraphs.  The default value is
  507.      `"^[ \t\n\f]"', which matches a line starting with a space, tab,
  508.      newline, or form feed.
  509.  
  510.  - Variable: sentence-end
  511.      This is the regular expression describing the end of a sentence.
  512.      (All paragraph boundaries also end sentences, regardless.)  The
  513.      default value is:
  514.  
  515.           "[.?!][]\"')}]*\\($\\|\t\\| \\)[ \t\n]*"
  516.  
  517.      This means a period, question mark or exclamation mark, followed
  518.      by a closing brace, followed by tabs, spaces or new lines.
  519.  
  520.      For a detailed explanation of this regular expression, see *Note
  521.      Regexp Example::.
  522.  
  523. 
  524. File: elisp,  Node: Searching and Case,  Prev: Standard Regexps,  Up: Searching and Matching
  525.  
  526. Searching and Case
  527. ==================
  528.  
  529.    By default, searches in Emacs ignore the case of the text they are
  530. searching through; if you specify searching for `FOO', then `Foo' or
  531. `foo' is also considered a match.  Regexps, and in particular character
  532. sets, are included: thus, `[aB]' would match `a' or `A' or `b' or `B'.
  533.  
  534.    If you do not want this feature, set the variable `case-fold-search'
  535. to `nil'.  Then all letters must match exactly, including case.  This
  536. is a per-buffer-local variable; altering the variable affects only the
  537. current buffer.  (*Note Intro to Buffer-Local::.)  Alternatively, you
  538. may change the value of `default-case-fold-search', which is the
  539. default value of `case-fold-search' for buffers that do not override it.
  540.  
  541.  - User Option: case-replace
  542.      This variable determines whether `query-replace' should preserve
  543.      case in replacements.  If the variable is `nil', then case need
  544.      not be preserved.
  545.  
  546.  - User Option: case-fold-search
  547.      This buffer-local variable determines whether searches should
  548.      ignore case.  If the variable is `nil' they do not ignore case;
  549.      otherwise they do ignore case.
  550.  
  551.  - Variable: default-case-fold-search
  552.      The value of this variable is the default value for
  553.      `case-fold-search' in buffers that do not override it.  This is the
  554.      same as `(default-value 'case-fold-search)'.
  555.  
  556. 
  557. File: elisp,  Node: Syntax Tables,  Next: Abbrevs,  Prev: Searching and Matching,  Up: Top
  558.  
  559. Syntax Tables
  560. *************
  561.  
  562.    A "syntax table" provides Emacs with the information that determines
  563. the syntactic use of each character in a buffer.  This information is
  564. used by the parsing commands, the complex movement commands, and others
  565. to determine where words, symbols, and other syntactic constructs begin
  566. and end.  The current syntax table controls the meaning of the word
  567. motion functions (*note Word Motion::.) and the list motion functions
  568. (*note List Motion::.) as well as the functions in this chapter.
  569.  
  570.    A syntax table is a vector of 256 elements; it contains one entry for
  571. each of the 256 ASCII characters of an 8-bit byte.  Each element is an
  572. integer that encodes the syntax of the character in question.
  573.  
  574.    Syntax tables are used only for moving across text, not for the GNU
  575. Emacs Lisp reader.  GNU Emacs Lisp uses built-in syntactic rules when
  576. reading Lisp expressions, and these rules cannot be changed.
  577.  
  578.    Each buffer has its own major mode, and each major mode has its own
  579. idea of the syntactic class of various characters.  For example, in Lisp
  580. mode, the character `;' begins a comment, but in C mode, it terminates
  581. a statement.  To support these variations, Emacs makes the choice of
  582. syntax table local to each buffer.  Typically, each major mode has its
  583. own syntax table and installs that table in each buffer which uses that
  584. mode.  Changing this table alters the syntax in all those buffers as
  585. well as in any buffers subsequently put in that mode.  Occasionally
  586. several similar modes share one syntax table.  *Note Example Major
  587. Modes::, for an example of how to set up a syntax table.
  588.  
  589.  - Function: syntax-table-p OBJECT
  590.      This function returns `t' if OBJECT is a vector of length 256
  591.      elements.  This means that the vector may be a syntax table.
  592.      However, according to this test, any vector of length 256 is
  593.      considered to be a syntax table, no matter what its contents.
  594.  
  595. * Menu:
  596.  
  597. * Syntax Descriptors::       How characters are classified.
  598. * Syntax Table Functions::   How to create, examine and alter syntax tables.
  599. * Motion and Syntax::         Moving over characters with certain syntaxes.
  600. * Parsing Expressions::      Parsing balanced expressions
  601.                                 using the syntax table.
  602. * Standard Syntax Tables::   Syntax tables used by various major modes.
  603. * Syntax Table Internals::   How syntax table information is stored.
  604.  
  605. 
  606. File: elisp,  Node: Syntax Descriptors,  Next: Syntax Table Functions,  Up: Syntax Tables
  607.  
  608. Syntax Descriptors
  609. ==================
  610.  
  611.    This section describes the syntax classes and flags that denote the
  612. syntax of a character, and how they are represented as a "syntax
  613. descriptor", which is a Lisp string that you pass to
  614. `modify-syntax-entry' to specify the desired syntax.
  615.  
  616.    Emacs defines twelve "syntax classes".  Each syntax table puts each
  617. character into one class.  There is no necessary relationship between
  618. the class of a character in one syntax table and its class in any other
  619. table.
  620.  
  621.    Each class is designated by a mnemonic character which serves as the
  622. name of the class when you need to specify a class.  Usually the
  623. designator character is one which is frequently put in that class;
  624. however, its meaning as a designator is unvarying and independent of how
  625. it is actually classified.
  626.  
  627.    A syntax descriptor is a Lisp string which specifies a syntax class,
  628. a matching character (unused except for parenthesis classes) and flags.
  629. The first character is the designator for a syntax class.  The second
  630. character is the character to match; if it is unused, put a space there.
  631. Then come the characters for any desired flags.  If no matching
  632. character or flags are needed, one character is sufficient.
  633.  
  634.    Thus, the descriptor for the character `*' in C mode is `. 23'
  635. (i.e., punctuation, matching character slot unused, second character of
  636. a comment-starter, first character of an comment-ender), and the entry
  637. for `/' is `. 14' (i.e., punctuation, matching character slot unused,
  638. first character of a comment-starter, second character of a
  639. comment-ender).
  640.  
  641. * Menu:
  642.  
  643. * Syntax Class Table::      Table of syntax classes.
  644. * Syntax Flags::            Additional flags each character can have.
  645.  
  646. 
  647. File: elisp,  Node: Syntax Class Table,  Next: Syntax Flags,  Up: Syntax Descriptors
  648.  
  649. Table of Syntax Classes
  650. -----------------------
  651.  
  652.    Here is a summary of the classes, the characters that stand for them,
  653. their meanings, and examples of their use.
  654.  
  655.  - Syntax class: whitespace character
  656.      "Whitespace characters" (designated with ` ' or `-') separate
  657.      symbols and words from each other.  Typically, whitespace
  658.      characters have no other syntactic use, and multiple whitespace
  659.      characters are syntactically equivalent to a single one.  Space,
  660.      tab, newline and formfeed are almost always considered whitespace.
  661.  
  662.  - Syntax class: word constituent
  663.      "Word constituents" (designated with `w') are parts of normal
  664.      English words and are typically used in variable and command names
  665.      in programs.  All upper and lower case letters and the digits are
  666.      typically word constituents.
  667.  
  668.  - Syntax class: symbol constituent
  669.      "Symbol constituents" (designated with `_') are the extra
  670.      characters that are used in variable and command names along with
  671.      word constituents.  For example, the symbol constituents class is
  672.      used in Lisp mode to indicate that certain characters may be part
  673.      of symbol names even though they are not part of English words.
  674.      These characters are `$&*+-_<>'.  In standard C, the only
  675.      non-word-constituent character that is valid in symbols is
  676.      underscore (`_').
  677.  
  678.  - Syntax class: punctuation character
  679.      "Punctuation characters" (`.') are those characters that are used
  680.      as punctuation in English, or are used in some way in a programming
  681.      language to separate symbols from one another.  Most programming
  682.      language modes, including Emacs Lisp mode, have no characters in
  683.      this class since the few characters that are not symbol or word
  684.      constituents all have other uses.
  685.  
  686.  - Syntax class: open parenthesis character
  687.  - Syntax class: close parenthesis character
  688.      Open and close "parenthesis characters" are characters used in
  689.      dissimilar pairs to surround sentences or expressions.  Such a
  690.      grouping is begun with an open parenthesis character and
  691.      terminated with a close.  Each open parenthesis character matches
  692.      a particular close parenthesis character, and vice versa.
  693.      Normally, Emacs indicates momentarily the matching open
  694.      parenthesis when you insert a close parenthesis.  *Note Blinking::.
  695.  
  696.      The class of open parentheses is designated with `(', and that of
  697.      close parentheses with `)'.
  698.  
  699.      In English text, and in C code, the parenthesis pairs are `()',
  700.      `[]', and `{}'.  In Emacs Lisp, the delimiters for lists and
  701.      vectors (`()' and `[]') are classified as parenthesis characters.
  702.  
  703.  - Syntax class: string quote
  704.      "String quote characters" (designated with `"') is used to delimit
  705.      string constants in many languages, including Lisp and C.  The
  706.      same string quote character appears at the beginning and the end
  707.      of a string.  Such quoted strings do not nest.
  708.  
  709.      The parsing facilities of Emacs consider a string as a single
  710.      token.  The usual syntactic meanings of the characters in the
  711.      string are suppressed.
  712.  
  713.      The Lisp modes have two string quote characters: double-quote (`"')
  714.      and vertical bar (`|').  `|' is not used in Emacs Lisp, but it is
  715.      used in Common Lisp.  C also has two string quote characters:
  716.      double-quote for strings, and single-quote (`'') for character
  717.      constants.
  718.  
  719.      English text has no string quote characters because English is not
  720.      a programming language.  Although quotation marks are used in
  721.      English, we do not want them to turn off the usual syntactic
  722.      properties of other characters in the quotation.
  723.  
  724.  - Syntax class: escape
  725.      An "escape character" (designated with `\') starts an escape
  726.      sequence such as is used in C string and character constants.  The
  727.      character `\' belongs to this class in both C and Lisp.  (In C, it
  728.      is used thus only inside strings, but it turns out to cause no
  729.      trouble to treat it this way throughout C code.)
  730.  
  731.      Characters in this class count as part of words if
  732.      `words-include-escapes' is non-`nil'.  *Note Word Motion::.
  733.  
  734.  - Syntax class: character quote
  735.      A "character quote character" (designated with `/') quotes the
  736.      following character so that it loses its normal syntactic meaning.
  737.      This differs from an escape character in that only the character
  738.      immediately following is ever affected.
  739.  
  740.      Characters in this class count as part of words if
  741.      `words-include-escapes' is non-`nil'.  *Note Word Motion::.
  742.  
  743.      This class is not currently used in any standard Emacs modes.
  744.  
  745.  - Syntax class: paired delimiter
  746.      "Paired delimiter characters" (designated with `$') are like
  747.      string quote characters except that the syntactic properties of the
  748.      characters between the delimiters are not suppressed.  Only TeX
  749.      mode uses a paired identical delimiter presently--the `$' that
  750.      begins and ends math mode.
  751.  
  752.  - Syntax class: expression prefix
  753.      An "expression prefix operator" (designated with `'') is used for
  754.      syntactic operators that are part of an expression if they appear
  755.      next to one but are not part of an adjoining symbol.  These
  756.      characters in Lisp include the apostrophe, `'' (used for quoting),
  757.      the comma, `,' (used in macros), and `#' (used in the read syntax
  758.      for certain data types).
  759.  
  760.  - Syntax class: comment starter
  761.  - Syntax class: comment ender
  762.      The "comment starter" and "comment ender" characters are used in
  763.      different languages to delimit comments.  These classes are
  764.      designated with `<' and `>', respectively.
  765.  
  766.      English text has no comment characters.  In Lisp, the semicolon
  767.      (`;') starts a comment and a newline or formfeed ends one.
  768.  
  769. 
  770. File: elisp,  Node: Syntax Flags,  Prev: Syntax Class Table,  Up: Syntax Descriptors
  771.  
  772. Syntax Flags
  773. ------------
  774.  
  775.    In addition to the classes, entries for characters in a syntax table
  776. can include flags.  There are six possible flags, represented by the
  777. characters `1', `2', `3', `4', `b' and `p'.
  778.  
  779.    All the flags except `p' are used to describe multi-character
  780. comment delimiters.  The digit flags indicate that a character can
  781. *also* be part of a comment sequence, in addition to the syntactic
  782. properties associated with its character class.  The flags are
  783. independent of the class and each other for the sake of characters such
  784. as `*' in C mode, which is a punctuation character, *and* the second
  785. character of a start-of-comment sequence (`/*'), *and* the first
  786. character of an end-of-comment sequence (`*/').
  787.  
  788.    The flags for a character C are:
  789.  
  790.    * `1' means C is the start of a two-character comment start sequence.
  791.  
  792.    * `2' means C is the second character of such a sequence.
  793.  
  794.    * `3' means C is the start of a two-character comment end sequence.
  795.  
  796.    * `4' means C is the second character of such a sequence.
  797.  
  798.    * `b' means that C as a comment delimiter belongs to the alternative
  799.      "b" comment style.
  800.  
  801.      Emacs can now supports two comment styles simultaneously.  (This
  802.      is for the sake of C++.)  More specifically, it can recognize two
  803.      different comment-start sequences.  Both must share the same first
  804.      character; only the second character may differ.  Mark the second
  805.      character of the "b"-style comment start sequence with the `b'
  806.      flag.
  807.  
  808.      The two styles of comment can have different comment-end
  809.      sequences.  A comment-end sequence (one or two characters) applies
  810.      to the "b" style if its first character has the `b' flag set;
  811.      otherwise, it applies to the "a" style.
  812.  
  813.      The appropriate comment syntax settings for C++ are as follows:
  814.  
  815.     `/'
  816.           `124b'
  817.  
  818.     `*'
  819.           `23'
  820.  
  821.     newline
  822.           `>b'
  823.  
  824.      Thus `/*' is a comment-start sequence for "a" style, `//' is a
  825.      comment-start sequence for "b" style, `*/' is a comment-end
  826.      sequence for "a" style, and newline is a comment-end sequence for
  827.      "b" style.
  828.  
  829.    * `p' identifies an additional "prefix character" for Lisp syntax.
  830.      These characters are treated as whitespace when they appear between
  831.      expressions.  When they appear within an expression, they are
  832.      handled according to their usual syntax codes.
  833.  
  834.      The function `backward-prefix-chars' moves back over these
  835.      characters, as well as over characters whose primary syntax class
  836.      is prefix (`'').
  837.  
  838. 
  839. File: elisp,  Node: Syntax Table Functions,  Next: Motion and Syntax,  Prev: Syntax Descriptors,  Up: Syntax Tables
  840.  
  841. Syntax Table Functions
  842. ======================
  843.  
  844.    In this section we describe functions for creating, accessing and
  845. altering syntax tables.
  846.  
  847.  - Function: make-syntax-table &optional TABLE
  848.      This function constructs a copy of TABLE and returns it.  If TABLE
  849.      is not supplied (or is `nil'), it returns a copy of the current
  850.      syntax table.  Otherwise, an error is signaled if TABLE is not a
  851.      syntax table.
  852.  
  853.  - Function: copy-syntax-table &optional TABLE
  854.      This function is identical to `make-syntax-table'.
  855.  
  856.  - Command: modify-syntax-entry CHAR SYNTAX-DESCRIPTOR &optional TABLE
  857.      This function sets the syntax entry for CHAR according to
  858.      SYNTAX-DESCRIPTOR.  The syntax is changed only for TABLE, which
  859.      defaults to the current buffer's syntax table, and not in any
  860.      other syntax table.  The argument SYNTAX-DESCRIPTOR specifies the
  861.      desired syntax; this is a string beginning with a class designator
  862.      character, and optionally containing a matching character and
  863.      flags as well.  *Note Syntax Descriptors::.
  864.  
  865.      This function always returns `nil'.  The old syntax information in
  866.      the table for this character is discarded.
  867.  
  868.      An error is signaled if the first character of the syntax
  869.      descriptor is not one of the twelve syntax class designator
  870.      characters.  An error is also signaled if CHAR is not a character.
  871.  
  872.      Examples:
  873.  
  874.           ;; Put the space character in class whitespace.
  875.           (modify-syntax-entry ?\  " ")
  876.                => nil
  877.           
  878.           ;; Make `$' an open parenthesis character,
  879.           ;;   with `^' as its matching close.
  880.           (modify-syntax-entry ?$ "(^")
  881.                => nil
  882.           
  883.           ;; Make `^' a close parenthesis character,
  884.           ;;   with `$' as its matching open.
  885.           (modify-syntax-entry ?^ ")$")
  886.                => nil
  887.           
  888.           ;; Make `/' a punctuation character,
  889.           ;;   the first character of a start-comment sequence,
  890.           ;;   and the second character of an end-comment sequence.
  891.           ;;   This is used in C mode.
  892.           (modify-syntax-entry ?/ ".13")
  893.                => nil
  894.  
  895.  - Function: char-syntax CHARACTER
  896.      This function returns the syntax class of CHARACTER, represented
  897.      by its mnemonic designator character.  This *only* returns the
  898.      class, not any matching parenthesis or flags.
  899.  
  900.      An error is signaled if CHAR is not a character.
  901.  
  902.      The first example shows that the syntax class of space is
  903.      whitespace (represented by a space).  The second example shows
  904.      that the syntax of `/' is punctuation in C-mode.  This does not
  905.      show the fact that it is also a comment sequence character.  The
  906.      third example shows that open parenthesis is in the class of open
  907.      parentheses.  This does not show the fact that it has a matching
  908.      character, `)'.
  909.  
  910.           (char-to-string (char-syntax ?\ ))
  911.                => " "
  912.           
  913.           (char-to-string (char-syntax ?/))
  914.                => "."
  915.           
  916.           (char-to-string (char-syntax ?\())
  917.                => "("
  918.  
  919.  - Function: set-syntax-table TABLE
  920.      This function makes TABLE the syntax table for the current buffer.
  921.      It returns TABLE.
  922.  
  923.  - Function: syntax-table
  924.      This function returns the current syntax table, which is the table
  925.      for the current buffer.
  926.  
  927. 
  928. File: elisp,  Node: Motion and Syntax,  Next: Parsing Expressions,  Prev: Syntax Table Functions,  Up: Syntax Tables
  929.  
  930. Motion and Syntax
  931. =================
  932.  
  933.    This section describes functions for moving across characters in
  934. certain syntax classes.  None of these functions exists in Emacs
  935. version 18 or earlier.
  936.  
  937.  - Function: skip-syntax-forward SYNTAXES &optional LIMIT
  938.      This function moves point forward across characters whose syntax
  939.      classes are mentioned in SYNTAXES.  It stops when it encounters
  940.      the end of the buffer, or position LIM (if specified), or a
  941.      character it is not supposed to skip.
  942.  
  943.      The return value is the distance traveled, which is a nonnegative
  944.      integer.
  945.  
  946.  - Function: skip-syntax-backward SYNTAXES &optional LIMIT
  947.      This function moves point backward across characters whose syntax
  948.      classes are mentioned in SYNTAXES.  It stops when it encounters
  949.      the beginning of the buffer, or position LIM (if specified), or a
  950.      character it is not supposed to skip.
  951.  
  952.      The return value indicates the distance traveled.  It is an
  953.      integer that is zero or less.
  954.  
  955.  - Function: backward-prefix-chars
  956.      This function moves point backward over any number of chars with
  957.      expression prefix syntax.  This includes both characters in the
  958.      expression prefix syntax class, and characters with the `p' flag.
  959.  
  960. 
  961. File: elisp,  Node: Parsing Expressions,  Next: Standard Syntax Tables,  Prev: Motion and Syntax,  Up: Syntax Tables
  962.  
  963. Parsing Balanced Expressions
  964. ============================
  965.  
  966.    Here are several functions for parsing and scanning balanced
  967. expressions.  The syntax table controls the interpretation of
  968. characters, so these functions can be used for Lisp expressions when in
  969. Lisp mode and for C expressions when in C mode.  *Note List Motion::,
  970. for convenient higher-level functions for moving over balanced
  971. expressions.
  972.  
  973.  - Function: parse-partial-sexp START LIMIT &optional TARGET-DEPTH
  974.           STOP-BEFORE STATE STOP-COMMENT
  975.      This function parses an expression in the current buffer starting
  976.      at START, not scanning past LIMIT.  Parsing stops at LIMIT or when
  977.      certain criteria described below are met; point is set to the
  978.      location where parsing stops.  The value returned is a description
  979.      of the status of the parse at the point where it stops.
  980.  
  981.      Normally, START is assumed to be the top level of an expression to
  982.      be parsed, such as the beginning of a function definition.
  983.      Alternatively, you might wish to resume parsing in the middle of an
  984.      expression.  To do this, you must provide a STATE argument that
  985.      describes the initial status of parsing.  If STATE is omitted (or
  986.      `nil'), parsing assumes that START is the beginning of a new parse
  987.      at level 0.
  988.  
  989.      If the third argument TARGET-DEPTH is non-`nil', parsing stops if
  990.      the depth in parentheses becomes equal to TARGET-DEPTH.  The depth
  991.      starts at 0, or at whatever is given in STATE.
  992.  
  993.      If the fourth argument STOP-BEFORE is non-`nil', parsing stops
  994.      when it comes to any character that starts a sexp.  If
  995.      STOP-COMMENT is non-`nil', parsing stops when it comes to the
  996.      start of a comment.
  997.  
  998.      The fifth argument STATE is a seven-element list of the same form
  999.      as the value of this function, described below.  The return value
  1000.      of one call may be used to initialize the state of the parse on
  1001.      another call to `parse-partial-sexp'.
  1002.  
  1003.      The result is a list of seven elements describing the final state
  1004.      of the parse:
  1005.  
  1006.        0. The depth in parentheses, starting at 0.
  1007.  
  1008.        1. The character position of the start of the innermost
  1009.           containing parenthetical grouping; `nil' if none.
  1010.  
  1011.        2. The character position of the start of the last complete
  1012.           subexpression terminated; `nil' if none.
  1013.  
  1014.        3. Non-`nil' if inside a string.  (It is the character that will
  1015.           terminate the string.)
  1016.  
  1017.        4. `t' if inside a comment.
  1018.  
  1019.        5. `t' if point is just after a quote character.
  1020.  
  1021.        6. The minimum parenthesis depth encountered during this scan.
  1022.  
  1023.      Elements 1, 4, 5, and 6 are significant in the argument STATE.
  1024.  
  1025.      This function is used to determine how to indent lines in programs
  1026.      written in languages that have nested parentheses.
  1027.  
  1028.  - Function: scan-lists FROM COUNT DEPTH
  1029.      This function scans forward COUNT balanced parenthetical groupings
  1030.      from character number FROM.  It returns the character number of
  1031.      the position thus found.
  1032.  
  1033.      If DEPTH is nonzero, parenthesis depth counting begins from that
  1034.      value.  The only candidates for stopping are places where the
  1035.      depth in parentheses becomes zero; `scan-lists' counts COUNT such
  1036.      places and then stops.  Thus, a positive value for DEPTH means go
  1037.      out levels of parenthesis.
  1038.  
  1039.      Comments are ignored if `parse-sexp-ignore-comments' is non-`nil'.
  1040.  
  1041.      If the beginning or end of the buffer (or its accessible portion)
  1042.      is reached and the depth is not zero, an error is signaled.  If
  1043.      the depth is zero but the count is not used up, `nil' is returned.
  1044.  
  1045.  - Function: scan-sexps FROM COUNT
  1046.      Scan from character number FROM by COUNT balanced expressions.  It
  1047.      returns the character number of the position thus found.
  1048.  
  1049.      Comments are ignored if `parse-sexp-ignore-comments' is non-`nil'.
  1050.  
  1051.      If the beginning or end of (the accessible part of) the buffer is
  1052.      reached in the middle of a parenthetical grouping, an error is
  1053.      signaled.  If the beginning or end is reached between groupings but
  1054.      before count is used up, `nil' is returned.
  1055.  
  1056.  - Variable: parse-sexp-ignore-comments
  1057.      If the value is non-`nil', then comments are treated as whitespace
  1058.      by the functions in this section and by `forward-sexp'.
  1059.  
  1060.      In older Emacs versions, this feature worked only when the comment
  1061.      terminator is something like `*/', and appears only to end a
  1062.      comment.  In languages where newlines terminate comments, it was
  1063.      necessary make this variable `nil', since not every newline is the
  1064.      end of a comment.  This limitation no longer exists.
  1065.  
  1066.    You can use `forward-comment' to move forward or backward over one
  1067. comment or several comments.
  1068.  
  1069.  - Function: forward-comment COUNT
  1070.      This function moves point forward across COUNT comments (backward,
  1071.      if COUNT is negative).  If it finds anything other than a comment
  1072.      or whitespace, it stops, leaving point at the place where it
  1073.      stopped.  It also stops after satisfying COUNT.
  1074.  
  1075.    To move forward over all comments and whitespace following point, use
  1076. `(forward-comment (buffer-size))'.  `(buffer-size)' is a good argument
  1077. to use, because the number of comments to skip cannot exceed that many.
  1078.  
  1079. 
  1080. File: elisp,  Node: Standard Syntax Tables,  Next: Syntax Table Internals,  Prev: Parsing Expressions,  Up: Syntax Tables
  1081.  
  1082. Some Standard Syntax Tables
  1083. ===========================
  1084.  
  1085.    Each of the major modes in Emacs has its own syntax table.  Here are
  1086. several of them:
  1087.  
  1088.  - Function: standard-syntax-table
  1089.      This function returns the standard syntax table, which is the
  1090.      syntax table used in Fundamental mode.
  1091.  
  1092.  - Variable: text-mode-syntax-table
  1093.      The value of this variable is the syntax table used in Text mode.
  1094.  
  1095.  - Variable: c-mode-syntax-table
  1096.      The value of this variable is the syntax table in use in C-mode
  1097.      buffers.
  1098.  
  1099.  - Variable: emacs-lisp-mode-syntax-table
  1100.      The value of this variable is the syntax table used in Emacs Lisp
  1101.      mode by editing commands.  (It has no effect on the Lisp `read'
  1102.      function.)
  1103.  
  1104. 
  1105. File: elisp,  Node: Syntax Table Internals,  Prev: Standard Syntax Tables,  Up: Syntax Tables
  1106.  
  1107. Syntax Table Internals
  1108. ======================
  1109.  
  1110.    Each element of a syntax table is an integer that translates into the
  1111. full meaning of the entry: class, possible matching character, and
  1112. flags.  However, it is not common for a programmer to work with the
  1113. entries directly in this form since the Lisp-level syntax table
  1114. functions usually work with syntax descriptors (*note Syntax
  1115. Descriptors::.).
  1116.  
  1117.    The low 8 bits of each element of a syntax table indicates the
  1118. syntax class.
  1119.  
  1120. Integer
  1121.      Class
  1122.  
  1123. 0
  1124.      whitespace
  1125.  
  1126. 1
  1127.      punctuation
  1128.  
  1129. 2
  1130.      word
  1131.  
  1132. 3
  1133.      symbol
  1134.  
  1135. 4
  1136.      open parenthesis
  1137.  
  1138. 5
  1139.      close parenthesis
  1140.  
  1141. 6
  1142.      expression prefix
  1143.  
  1144. 7
  1145.      string quote
  1146.  
  1147. 8
  1148.      paired delimiter
  1149.  
  1150. 9
  1151.      escape
  1152.  
  1153. 10
  1154.      character quote
  1155.  
  1156. 11
  1157.      comment-start
  1158.  
  1159. 12
  1160.      comment-end
  1161.  
  1162.    The next 8 bits are the matching opposite parenthesis (if the
  1163. character has parenthesis syntax); otherwise, they are not meaningful.
  1164. The next 6 bits are the flags.
  1165.  
  1166. 
  1167. File: elisp,  Node: Abbrevs,  Next: Processes,  Prev: Syntax Tables,  Up: Top
  1168.  
  1169. Abbrevs And Abbrev Expansion
  1170. ****************************
  1171.  
  1172.    An abbreviation or "abbrev" is a string of characters that may be
  1173. expanded to a longer string.  The user can insert the abbrev string and
  1174. find it replaced automatically with the expansion of the abbrev.  This
  1175. saves typing.
  1176.  
  1177.    The set of abbrevs currently in effect is recorded in an "abbrev
  1178. table".  Each buffer has a local abbrev table, but normally all buffers
  1179. in the same major mode share one abbrev table.  There is also a global
  1180. abbrev table.  Normally both are used.
  1181.  
  1182.    An abbrev table is represented as an obarray containing a symbol for
  1183. each abbreviation.  The symbol's name is the abbreviation.  Its value is
  1184. the expansion; its function definition is the hook; its property list
  1185. cell contains the use count, the number of times the abbreviation has
  1186. been expanded.  Because these symbols are not interned in the usual
  1187. obarray, they will never appear as the result of reading a Lisp
  1188. expression; in fact, they will never be used except by the code that
  1189. handles abbrevs.  Therefore, it is safe to use them in an extremely
  1190. nonstandard way.  *Note Creating Symbols::.
  1191.  
  1192.    For the user-level commands for abbrevs, see *Note Abbrev Mode:
  1193. (emacs)Abbrevs.
  1194.  
  1195. * Menu:
  1196.  
  1197. * Abbrev Mode::                 Setting up Emacs for abbreviation.
  1198. * Tables: Abbrev Tables.        Creating and working with abbrev tables.
  1199. * Defining Abbrevs::            Specifying abbreviations and their expansions.
  1200. * Files: Abbrev Files.          Saving abbrevs in files.
  1201. * Expansion: Abbrev Expansion.  Controlling expansion; expansion subroutines.
  1202. * Standard Abbrev Tables::      Abbrev tables used by various major modes.
  1203.  
  1204. 
  1205. File: elisp,  Node: Abbrev Mode,  Next: Abbrev Tables,  Prev: Abbrevs,  Up: Abbrevs
  1206.  
  1207. Setting Up Abbrev Mode
  1208. ======================
  1209.  
  1210.    Abbrev mode is a minor mode controlled by the value of the variable
  1211. `abbrev-mode'.
  1212.  
  1213.  - Variable: abbrev-mode
  1214.      A non-`nil' value of this variable turns on the automatic expansion
  1215.      of abbrevs when their abbreviations are inserted into a buffer.
  1216.      If the value is `nil', abbrevs may be defined, but they are not
  1217.      expanded automatically.
  1218.  
  1219.      This variable automatically becomes local when set in any fashion.
  1220.  
  1221.  - Variable: default-abbrev-mode
  1222.      This is the value `abbrev-mode' for buffers that do not override
  1223.      it.  This is the same as `(default-value 'abbrev-mode)'.
  1224.  
  1225.